package com.example.springbootdemo.controller;

import com.example.springbootdemo.custom.JjsmUserCustom;
import com.example.springbootdemo.service.ITestService;
import com.example.springbootdemo.utils.NumericUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @需求描述:
 * @创建人:whh
 * @创建时间: 2020/8/9
 * @修改需求:
 * @修改人:
 * @修改时间:
 * @需求思路:
 */
@RestController
@Api(value = "/test", tags = "测试接口")
@RequestMapping(value = "/test")
public class TestController {

    @Autowired
    private ITestService testService;

    @ApiOperation(value = "打招呼", notes = "打招呼")
    @RequestMapping(value = "/hello", method = RequestMethod.POST)
    public List<JjsmUserCustom> hello(HttpServletRequest request, @RequestBody Map map) {
        System.out.println(map.get("token"));
        System.out.println(map.get("token2"));

        List<JjsmUserCustom> userCustoms = (List<JjsmUserCustom>) map.get("data");
        System.out.println(userCustoms);
        return this.testService.hello();
    }


    @ApiOperation(value = "测试", notes = "测试")
    @RequestMapping(value = "/test", method = RequestMethod.POST)
    public Integer test(HttpServletRequest request, @RequestBody Map map) {

        return 1;
    }


    public static void main(String[] args) {

        double a = 0.6;
        double b = 3;

        System.out.println(a / b);
        System.out.println(NumericUtil.divide(a,b));
    }
}
